<template>
  <div>
    <h1 class="fzls-title">欢迎来到新中国象棋</h1>
    <div class="center">
      <el-carousel
        indicator-position="outside"
        :interval="2000"
      >
        <el-carousel-item
          v-for="(img, index) in imgSrcList"
          :key="`img${index}`"
        >
          <img :src="img">
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>

<script>
const imgList = [
  require('@/assets/images/index1.png'),
  require('@/assets/images/index2.png'),
  require('@/assets/images/index3.png')
];
export default {
  name: 'Index',
  props: {
    imgSrcList: {
      type: Array,
      default: () => imgList
    }
  },
  created() {
    this.$cookies.set('cookieTest', 1, 1);
    if (this.$cookies.isKey('cookieTest')) {
      this.$cookies.remove('cookieTest');
    }
    else {
      this.$notify({
        title: '注意',
        message: '您的浏览器未开启cookies，请开启后重试'
      });
    }
  }
};
</script>

<style scoped>
.el-carousel {
  width: 1000px;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
